//
//  SaleVC.m
//  AppNew
//
//  Created by 华伟 on 2019/4/10.
//  Copyright © 2019 华伟. All rights reserved.
//

#import "SaleVC.h"
#import <ActionSheetPicker.h>
@interface SaleVC ()<UITextFieldDelegate>
@property (weak, nonatomic) IBOutlet UIButton *countryBtn;
@property (weak, nonatomic) IBOutlet UIButton *coinBtn;
@property (weak, nonatomic) IBOutlet UITextField *priceTextf;
@property (weak, nonatomic) IBOutlet UITextField *limitMinTextf;
@property (weak, nonatomic) IBOutlet UITextField *limitMaxTextf;
@property (weak, nonatomic) IBOutlet UITextField *numberiTextf;
@property (weak, nonatomic) IBOutlet UIButton *timeLimitBtn;
@property (weak, nonatomic) IBOutlet UIButton *payStyleBtn;
@property (weak, nonatomic) IBOutlet UITextField *payPassTextf;
@property (weak, nonatomic) IBOutlet UITextView *markTextView;

@end

@implementation SaleVC
-(void)timeWasSelected:(NSDate *)selectedTime element:(id)element {
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"h:mm a"];
    [element setText:[dateFormatter stringFromDate:selectedTime]];
}

- (IBAction)countryAction:(UIButton *)sender {//选择国家
//    ActionSheetDatePicker *datePicker = [[ActionSheetDatePicker alloc]
//                                                initWithTitle:@"选择时间"
//                                                datePickerMode:UIDatePickerModeDateAndTime
//                                                selectedDate:[NSDate date]
//                                                doneBlock:^(ActionSheetDatePicker *picker, id selectedDate, id origin) {
//
//                                                }
//                                                cancelBlock:^(ActionSheetDatePicker *picker) {
//
//                                                }
//                                                origin:sender];
//    datePicker.timeZone = [NSTimeZone timeZoneWithName:@"Asia/Shanghai"];
////    datePicker.locale = [[NSLocale alloc]initWithLocaleIdentifier:@"zh-Hans"];
//    datePicker.minuteInterval = 5;
//    [datePicker showActionSheetPicker];
    
    NSArray *country = [NSArray arrayWithObjects:@"中国",@"蒙古",@"朝鲜",@"韩国",@"日本",@"香港",@"澳门",@"台湾",@"菲律宾",@"越南",@"老挝",@"柬埔寨",@"缅甸",@"泰国",@"西亚",@"文莱",@"新加坡",@"印度尼西亚",@"东帝汶",@"加拿大",@"美国",@"墨西哥",@"哥伦比亚",@"委内瑞拉",@"圭亚那",@"法属圭亚那",@"苏里南",nil];
    
    [ActionSheetStringPicker showPickerWithTitle:@"选择国家"
                                            rows:country
                                initialSelection:0
                                       doneBlock:^(ActionSheetStringPicker *picker, NSInteger selectedIndex, id selectedValue) {
                                           NSLog(@"Picker: %@, Index: %ld, value: %@",
                                                 picker, (long)selectedIndex, selectedValue);
                                       }
                                     cancelBlock:^(ActionSheetStringPicker *picker) {
                                         NSLog(@"Block Picker Canceled");
                                     }
                                          origin:sender];
    
    
}
- (IBAction)coinAction:(UIButton *)sender {
    NSArray *colors = [NSArray arrayWithObjects:@"USDT", @"HUSD", @"BTC", @"ETH", @"HT",nil];
    
    [ActionSheetStringPicker showPickerWithTitle:@"选择货币"
                                            rows:colors
                                initialSelection:0
                                       doneBlock:^(ActionSheetStringPicker *picker, NSInteger selectedIndex, id selectedValue) {
                                           NSLog(@"Picker: %@, Index: %ld, value: %@",
                                                 picker, (long)selectedIndex, selectedValue);
                                           [self->_coinBtn setTitle:[NSString stringWithFormat:@"%@",selectedValue] forState:UIControlStateNormal];
                                       }
                                     cancelBlock:^(ActionSheetStringPicker *picker) {
                                         NSLog(@"Block Picker Canceled");
                                     }
                                          origin:sender];
}
- (IBAction)dateAction:(UIButton *)sender {
//    Actionsheet
}
- (IBAction)payStyleAction:(UIButton *)sender {
}
- (IBAction)releaseAction:(id)sender {
}

- (void)_selfDelegate{
    _priceTextf.delegate = self;
    _limitMinTextf.delegate = self;
    _limitMaxTextf.delegate = self;
    _numberiTextf.delegate = self;
    _payPassTextf.delegate = self;
}


- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"发布出售订单";
    [self _selfDelegate];
}

@end
